package com.car.advertising.activity.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.car.advertising.R;
import com.car.advertising.entity.bean.ReceiveBean;
import com.support.widget.layout.adapter.BaseRecyclerViewAdapter;
import com.support.widget.layout.holder.BaseViewHolder;

import java.util.List;

/**
 * 开发者：LuoYi
 * Time: 2017 17:53 2017/5/2 05
 */

public class ReceiveRecordAdapter extends BaseRecyclerViewAdapter<ReceiveBean, BaseViewHolder> {

    public ReceiveRecordAdapter(Context context, List<ReceiveBean> strings) {
        super(context, strings);
    }

    public void setRefreshList(List<ReceiveBean> strings) {
        this.mDatas = strings;
        notifyDataSetChanged();
    }

    @Override
    protected void bindView(BaseViewHolder holder, int position, ReceiveBean model) {
        ReceiveHolder receiveHolder = (ReceiveHolder) holder;
        receiveHolder.nameTv.setText(model.getUserName());
        receiveHolder.timeTv.setText(model.getTakeTime());
//        receiveHolder.amountTv.setText(model);
    }

    @Override
    public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.activity_receive_record, parent, false);
        return new ReceiveHolder(mContext, view, this);
    }

    class ReceiveHolder extends BaseViewHolder {

        public TextView nameTv;
        public TextView timeTv;
        public TextView amountTv;

        public ReceiveHolder(Context context, View rootView, BaseRecyclerViewAdapter mBaseRecyclerViewAdapter) {
            super(context, rootView, mBaseRecyclerViewAdapter);
            nameTv = (TextView) rootView.findViewById(R.id.receive_name_tv);
            timeTv = (TextView) rootView.findViewById(R.id.receive_time_tv);
            amountTv = (TextView) rootView.findViewById(R.id.receive_amount_tv);
        }
    }
}
